﻿
using System;
namespace sharpxbot.Plugins.BibleSearch.Data
{
    public class Query
    {
        public string BookName { get; set; }
        public int ChapterIndex { get; set; }
        public int StartVerse { get; set; }
        public int EndVerse { get; set; }
        public string FullTextSearch { get; set; }
        public string FuzzySearch { get; set; }

        public QueryType QueryType
        {
            get
            {
                if (!String.IsNullOrWhiteSpace(FuzzySearch))
                {
                    return QueryType.FuzzySearch;
                }

                if (String.IsNullOrWhiteSpace(FullTextSearch))
                {
                    if (ChapterIndex > 0)
                    {
                        if (StartVerse > 0)
                        {
                            if (EndVerse == 0)
                                return QueryType.SpecificVerse;
                            else
                                return QueryType.VersesRange;
                        }

                        return QueryType.WholeChapter;
                    }
                }

                return QueryType.FullTextSearch;
            }
        }
    }
}
